import { View } from "../../../../../mvc/core/View";
import { ILayOut } from "../../../../../../modules/interfaces/ILayOut";
import { Language } from "../../../../../../extend/language/Language";
import { LayerManager } from "../../../../manager/LayerManager";
import { ObjCreate } from "../../../common/ObjCreate";
import { ImagesConst } from "../../../../resource/ImagesConst";
import { SecTimerView } from "../../../common/SecTimerView";
import { FilterConst } from "../../../../../component/gconst/FilterConst";
import { GTextFormat } from "../../../../../common/GTextFormat";
import { FontUtil } from "../../../../../common/font/FontUtil";
import { Cache } from "../../../../cache/Cache";
import { EArenaProcess } from "../../../../../../Message/Public/EArenaProcess";
import { GameDefConfig } from "../../../../resource/GameDefConfig";
import { Global } from "../../../../../../com/gengine/global/Global";
type int = number;
//class GroupMatchStartCD
    
    export  class GroupMatchStartCD extends View implements ILayOut
    {
        constructor()
        {
            super();
            this._parseTxt = Language.getString(44272);
            this._parseTxtFinal = Language.getString(44337);
            this._parseTxtFinalEnd = Language.getString(44367);
            this.layer = LayerManager.topLayer;
            this.resetPosition();
            this.mouseEnabled = false;
            this.mouseChildren = false;
            this.init();
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 300, 45, this, ImagesConst.ToolTipBg);
            this._tfLeftTime = new SecTimerView();
            this._tfLeftTime.filters = [FilterConst.glowFilter];
            this._tfLeftTime.mouseEnabled = false;
            var loc1=new GTextFormat(FontUtil.songtiName, 13, 15788607);
            loc1.bold = true;
            this._tfLeftTime.defaultTextFormat = loc1;
            this._tfLeftTime.filters = [FilterConst.glowFilter];
            this._tfLeftTime.setParse(this._parseTxt);
            this._tfLeftTime.timeOutHandler = hide;
            ObjCreate.setObjAttri(this._tfLeftTime, 44, 13, 300, 30, this);
            return;
        }

        public updateLeftTime(arg1: int, arg2: int, arg3: int): void
        {
            var loc1=null;
            if (Cache.instance.arenaCross.arenaCrossInfo.process >= EArenaProcess._EArenaFinalMatch1) 
            {
                if (arg2 >= 4) 
                {
                    loc1 = this._parseTxtFinalEnd.replace("{0}", GameDefConfig.instance.getArenaCrossFinalNumText(arg1));
                }
                else 
                {
                    loc1 = (loc1 = this._parseTxtFinal.replace("{0}", GameDefConfig.instance.getArenaCrossFinalNumText(arg1))).replace("{1}", arg2.toString());
                }
                this._tfLeftTime.setParse(loc1);
            }
            else 
            {
                this._tfLeftTime.setParse(this._parseTxt.replace("{0}", arg1.toString()));
            }
            this._tfLeftTime.setLeftTime(arg3);
            return;
        }

        public isEnd(): Boolean
        {
            return !this._tfLeftTime.secTimerViewData || this._tfLeftTime.secTimerViewData.leftTime <= 0;
        }

        public addComplCallBack(arg1: Function): void
        {
            this._tfLeftTime.timeOutHandler = arg1;
            return;
        }

        public resetPosition(): void
        {
            this.x = (Global.stage.stageWidth - 300) / 2;
            this.y = 90;
            return;
        }

        public /* override */ dispose(arg1: Boolean=true): void
        {
            this._tfLeftTime.dispose();
            this._tfLeftTime = null;
            return;
        }

        /* internal */ /* var */_tfLeftTime: SecTimerView;

        /* internal */ /* var */_parseTxt: string;

        /* internal */ /* var */_parseTxtFinal: string;

        /* internal */ /* var */_parseTxtFinalEnd: string;
    }
